// #############################################
// Header
// ############################################

// Logo
.logo {
    height: 3.25rem;
    margin-left: 2.25rem;
}

// Search Box
.search {
    flex: 0 0 40%;
    // background-color: orangered;

    display: flex;
    align-items: center;
    justify-content: center;

    &__input {
        font-family: inherit;
        font-size: inherit;
        color: inherit;
        background-color: var(--color-grey-light-2);
        border: none;
        padding: 0.7rem 2rem;
        border-radius: 10rem;
        width: 90%;
        transition: all 0.2s;
        margin-right: -3.7rem;

        &:focus {
            outline: none;
            width: 100%;
            background-color: var(--color-grey-light-3);
        }
        &::-webkit-input-placeholder {
            font-weight: 100;
            color: var(--color-grey-light-4);
        }
    }

    // 这里不能把它放到input体内，那样的话就找不到button了
    &__input:focus + &__button {
        background-color: var(--color-grey-light-3);
    }

    &__button {
        // 去除button自带的border样式
        border: none;
        background-color: var(--color-grey-light-2);

        &:focus {
            outline: none;
        }

        &:active {
            transform: translateY(2px);
        }
    }
    &__icon {
        height: 2rem;
        width: 2rem;
        fill: var(--color-grey-dark-3);
    }
}

// User Nav

.user-nav {
    display: flex;
    align-items: center;
    align-self: stretch;
    & > * {
        padding: 0 2rem;
        align-self: stretch;
        display: flex;
        align-items: center;
        &:hover {
            background-color: var(--color-grey-light-2);
        }
    }
    &__icon-box {
        position: relative;
    }
    &__icon {
        height: 2.25rem;
        width: 2.25rem;
        fill: var(--color-grey-dark-3);
    }
    &__notification {
        font-size: 0.8rem;
        height: 1.75rem;
        width: 1.75rem;
        border-radius: 50%;
        color: white;
        background-color: var(--color-primary);
        // position icon
        position: absolute;
        top: 1.5rem;
        right: 1.1rem;
        // align text
        display: flex;
        align-items: center;
        justify-content: center;
    }

    &__user-photo {
        height: 3.75rem;
        border-radius: 50%;
        margin-right: 1rem;
    }
}

// #############################################
// side navigation
// ############################################

.side-nav {
    font-size: 1.4rem;
    list-style: none;
    margin-top: 3.5rem;
    &__item {
        position: relative;
        &:not(:last-child) {
            margin-bottom: 0.5rem;
        }
    }

    &__item::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        width: 3px;
        background-color: var(--color-primary);
        transform: scaleY(0);
        transition: transform 0.2s, width 0.4s cubic-bezier(1, 0, 0, 1) 0.2s, background-color 0.1s;
    }
    // 指针悬浮和选中的item都有效果
    &__item:hover::before,
    &__item--active::before {
        transform: scaleY(1);
        width: 100%;
    }
    // 背景颜色动画
    &__item:active::before {
        background-color: var(--color-primary-light);
    }

    &__link:link,
    &__link:visited {
        color: var(--color-grey-light-1);
        text-decoration: none;
        display: block;
        padding: 1.5rem 3rem;
        display: flex;
        align-items: center;
        // 添加 relative 和 z-index 使link的字体可以在before元素之上显示
        position: relative;
        z-index: 10;
    }
    &__link:hover {
        color: white;
    }
    &__icon {
        // 使用currentColor可以使用当前元素或者父亲元素的color，即使是hover也可以一起跟着变
        width: 1.75rem;
        height: 1.75rem;
        margin-right: 2rem;
        fill: currentColor;
    }
}

.legal {
    font-size: 1.2rem;
    color: var(--color-grey-light-4);
    text-align: center;
    padding: 2.5rem;
}

// ##########################################

// Gallery

// #########################################

.gallery {
    display: flex;
    &__photo {
        width: 100%;
        // to do ?
        display: block;
    }
}

// ##########################################

// Overview

// #########################################

.overview {
    display: flex;
    align-items: center;
    border-bottom: var(--line);
    &__heading {
        font-size: 2.25rem;
        font-weight: 300;
        text-transform: uppercase;
        letter-spacing: 1px;
        padding: 1.5rem;
    }
    &__stars {
        // 配合flexbox使用的trick 非常有用
        margin-right: auto;
        // svg文件是inline，使用flexbox可以消除start间的white space
        display: flex;
    }

    &__icon-star,
    &__icon-location {
        height: 1.75rem;
        width: 1.75rem;
        fill: var(--color-primary);
    }

    &__location {
        font-size: 1.2rem;
        display: flex;
        align-items: center;
    }

    &__icon-location {
        margin-right: 0.5rem;
    }

    &__rating {
        align-self: stretch;
        background-color: var(--color-primary);
        color: white;
        margin-left: 3rem;
        padding: 0 2.25rem;
        // 使文字水平和垂直居中
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    &__rating-average {
        font-size: 2.25rem;
        font-weight: 300;
        margin-bottom: -3px;
    }
    &__rating-count {
        font-size: 0.8rem;
        text-transform: uppercase;
    }
}

.btn-inline {
    border: none;
    color: var(--color-primary);
    // 使用currentColor可以避免在hover或者其他状态时候，手动修改颜色
    border-bottom: 1px solid currentColor;
    // make button more modular and resuable
    font-size: inherit;
    padding-bottom: 2px;
    display: inline-block;
    // 默认值是buttonface
    background-color: transparent;
    cursor: pointer;
    transition: all 0.2s;

    & span {
        margin-left: 3px;
        transition: margin-left 0.2s;
    }

    &:hover {
        color: var(--color-grey-dark-1);
        span {
            margin-left: 8px;
        }
    }
    &:hover {
        color: var(--color-grey-dark-1);
    }

    &:focus {
        outline: 0;
        animation: pulstate 1s infinite;
    }
}

@keyframes pulstate {
    0% {
        transform: 0;
        box-shadow: none;
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 1rem 4rem rgba(0, 0, 0, 0.2);
    }
    100% {
        transform: 0;
        box-shadow: none;
    }
}

// ########################
// Paragraph
// ########################
// 设置 P中的最后一个 而不是所有的子元素

.paragraph:not(:last-of-type) {
    margin-bottom: 2rem;
}

.list {
    list-style: none;
    margin: 3rem 0;
    padding: 3rem 0;
    border-top: var(--line);
    border-bottom: var(--line);
    display: flex;
    flex-wrap: wrap;
    &__item {
        flex: 0 0 50%;
        margin-bottom: 0.7rem;
    }
    &__item::before {
        content: "";
        display: inline-block;
        height: 1rem;
        width: 1rem;
        margin-right: 0.7rem;
        // old way of add icon, as it can not change the color
        // background-image: url(/img/chevron-thin-right.svg);
        // background-size: cover;
        background-color: var(--color-primary);
        -webkit-mask-image: url(/img/chevron-thin-right.svg);
        -webkit-mask-size: cover;
    }
}

/* Recommend */
.recommend {
    font-size: 1.3rem;
    color: var(--color-grey-dark-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    &__count {
    }
    &__friends {
    }
    &__photo {
        // 设置content-box是为了添加border方便，所以image本身的大小就是4rem
        box-sizing: content-box;
        height: 4rem;
        width: 4rem;
        border-radius: 50%;
        border: 3px solid #fff;

        &:not(:last-child) {
            margin-right: -2rem;
        }
    }
}

/* review */

.review {
    background: white;
    box-shadow: var(--shadow-light);
    padding: 3rem;
    margin-bottom: 3rem;
    position: relative;
    // overflow: hidd;
    &__text {
        margin-bottom: 2rem;
        position: relative;
        z-index: 10;
    }
    &__user {
        padding: 2rem 0;
        display: flex;
        align-items: center;
    }
    &__photo {
        height: 4.5rem;
        width: 4.5rem;
        border-radius: 50%;
        margin-right: 1.5rem;
    }
    &__user-box {
        margin-right: auto;
    }
    &__user-name {
        font-size: 1.1rem;
        font-weight: 600;
        text-transform: uppercase;
        margin-bottom: 0.4rem;
    }
    &__user-date {
        font-size: 1.1rem;
        color: var(--color-grey-dark-3);
    }
    &__rating {
        color: var(--color-primary);
        font-size: 2.2rem;
        font-weight: 600;
    }
    &::before {
        content: "\201C";
        font-family: sans-serif;
        line-height: 1;
        position: absolute;
        top: -2.75rem;
        left: -1rem;
        font-size: 20rem;
        color: var(--color-grey-light-2);
        z-index: 1;
    }
}

/*----------  Subsection comment block  ----------*/

.cta {
    padding: 3.5rem 0;
    text-align: center;
    &__book-now {
        font-size: 1.5rem;
        font-weight: 300;
        text-transform: uppercase;
        margin-bottom: 2.5rem;
    }
}

.btn {
    font-size: 1.5rem;
    font-weight: 300;
    text-transform: uppercase;
    border-radius: 100px;
    border: none;
    background-image: linear-gradient(to right, var(--color-primary-light), var(--color-primary-dark));
    position: relative;
    // 控制伪元素的溢出，伪元素也是这个元素内容的一部分
    overflow: hidden;
    cursor: pointer;
    & > * {
        display: inline-block;
        height: 100%;
        width: 100%;
        transition: all 0.2s;
    }
    &__visible {
        padding: 2rem 7.5rem;
    }
    &__invisible {
        position: absolute;
        padding: 2rem 0;
        left: 0;
        top: -100%;
    }

    &:hover {
        background-image: linear-gradient(to left, var(--color-primary-light), var(--color-primary-dark));
    }
    &:hover &__visible {
        transform: translateY(100%);
    }
    &:hover &__invisible {
        top: 0;
    }
    &:focus {
        outline: none;
        animation: pulstate 1s infinite;
    }
}
